﻿<common:UserControlBase x:Class="ExchangeTracker.Presentation.Views.SettingView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                                        xmlns:common="clr-namespace:ExchangeTracker.Presentation.Common"
                                        xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid"
                                        xmlns:dxmvvm="http://schemas.devexpress.com/winfx/2008/xaml/mvvm"
                                        DataContext="{Binding Source={StaticResource Locator}, Path=SettingViewModel}"
                                        mc:Ignorable="d"
             d:DesignHeight="300" d:DesignWidth="300">
    <UserControl.Resources>
    </UserControl.Resources>
    <StackPanel>
        <common:LayoutItem Label="بازه زمانی بروزرسانی: " Background="Olive">
            <ComboBox SelectedItem="{Binding SelectedInterval,UpdateSourceTrigger=PropertyChanged}" ItemsSource="{Binding Intervals}" Width="200" HorizontalAlignment="Left"/>
        </common:LayoutItem>
        <Grid Height="500">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="*"/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <Button Grid.Row="0" Grid.Column="0" Background="MintCream" HorizontalAlignment="Left" Style="{DynamicResource MetroCircleButtonStyle}" Width="50" Height="50" Command="{Binding DeleteDataCompanyCommand}" Content="حذف"/>
            <dxg:GridControl Grid.Row="1" Grid.Column="0" ItemsSource="{Binding Companies}" SelectionMode="Row" SelectedItem="{Binding SelectedCompany}">
                <dxg:GridControl.Columns>
                    <dxg:GridColumn Header="نماد" FieldName="Symbol"/>
                </dxg:GridControl.Columns>
                <dxg:GridControl.View>
                    <dxg:TableView ShowGroupedColumns="False" AllowGrouping="False" ShowGroupPanel="False"
                       AllowEditing="False" ShowAutoFilterRow="True"  UseLightweightTemplates="None">
                        <dxmvvm:Interaction.Triggers>
                            <dxmvvm:EventToCommand EventName="RowDoubleClick"
                                   Command="{Binding AddCompanyCommand}"
                                   PassEventArgsToCommand="False">
                            </dxmvvm:EventToCommand>
                        </dxmvvm:Interaction.Triggers>
                        <dxg:TableView.HeaderTemplate>
                            <DataTemplate>
                                <TextBlock Text="لیست انتخاب نماد ها"></TextBlock>
                            </DataTemplate>
                        </dxg:TableView.HeaderTemplate>
                    </dxg:TableView>
                </dxg:GridControl.View>
            </dxg:GridControl>

            <dxg:GridControl Grid.Row="1" Grid.Column="1" ItemsSource="{Binding LiveCompanies}" SelectionMode="Row"  
                     SelectedItem="{Binding SelectedLiveCompany}" Background="LightCyan">
                <dxg:GridControl.Columns>
                    <dxg:GridColumn Header="نماد" FieldName="Symbol"/>
                </dxg:GridControl.Columns>
                <dxg:GridControl.View>
                    <dxg:TableView x:Name="View" ShowGroupedColumns="False" AllowGrouping="False" ShowGroupPanel="False"
                       AllowEditing="False"  UseLightweightTemplates="None">
                        <dxmvvm:Interaction.Triggers>
                            <dxmvvm:EventToCommand EventName="RowDoubleClick"
                                   Command="{Binding RemoveCompanyCommand}"
                                   PassEventArgsToCommand="False">
                            </dxmvvm:EventToCommand>
                        </dxmvvm:Interaction.Triggers>

                        <dxg:TableView.HeaderTemplate>
                            <DataTemplate>
                                <TextBlock Text="نمادهای انتخاب شده که حذف نشوند"></TextBlock>
                            </DataTemplate>
                        </dxg:TableView.HeaderTemplate>
                    </dxg:TableView>
                </dxg:GridControl.View>
            </dxg:GridControl>
        </Grid>
    </StackPanel>
</common:UserControlBase>
